<?php
  $user = $_POST['username'];
  $pass = $_POST['password'];

 $conn =  mysqli_connect("localhost","root","root","my2208");

 if ($conn) {
      $sql = "select * from student where username='$user' and userpass = '$pass'" ;
      $res = mysqli_query($conn,$sql);
      $nums = mysqli_num_rows($res);
      if ($nums!=0) {
          echo '1';  # 1 --->成功
      } else {
          echo '0';  # 0 --->失败
      }
      
 } else {
   echo 'connect error';
 }

?>